/// 挑战任务模型
class QuestModel {
  final String id;
  final String title;
  final double distance; // 里程数（公里）
  final int minTime; // 最小时间（分钟）
  final int maxTime; // 最大时间（分钟）
  final String image; // 挑战图片
  final String description;

  QuestModel({
    required this.id,
    required this.title,
    required this.distance,
    required this.minTime,
    required this.maxTime,
    required this.image,
    required this.description,
  });

  QuestModel copyWith({
    String? id,
    String? title,
    double? distance,
    int? minTime,
    int? maxTime,
    String? image,
    String? description,
  }) {
    return QuestModel(
      id: id ?? this.id,
      title: title ?? this.title,
      distance: distance ?? this.distance,
      minTime: minTime ?? this.minTime,
      maxTime: maxTime ?? this.maxTime,
      image: image ?? this.image,
      description: description ?? this.description,
    );
  }
}

/// 挑战参与记录模型
class QuestAttemptModel {
  final String id;
  final String questId;
  final String userId;
  final DateTime startTime;
  final DateTime? endTime;
  final String? startImage; // 开始时的图片
  final String? endImage; // 结束时的图片
  final bool isCompleted;
  final Duration? duration; // 实际用时

  QuestAttemptModel({
    required this.id,
    required this.questId,
    required this.userId,
    required this.startTime,
    this.endTime,
    this.startImage,
    this.endImage,
    this.isCompleted = false,
    this.duration,
  });

  QuestAttemptModel copyWith({
    String? id,
    String? questId,
    String? userId,
    DateTime? startTime,
    DateTime? endTime,
    String? startImage,
    String? endImage,
    bool? isCompleted,
    Duration? duration,
  }) {
    return QuestAttemptModel(
      id: id ?? this.id,
      questId: questId ?? this.questId,
      userId: userId ?? this.userId,
      startTime: startTime ?? this.startTime,
      endTime: endTime ?? this.endTime,
      startImage: startImage ?? this.startImage,
      endImage: endImage ?? this.endImage,
      isCompleted: isCompleted ?? this.isCompleted,
      duration: duration ?? this.duration,
    );
  }
}
